#[derive(Debug, PartialEq)]
pub enum LayerType {
    Walkable,
    Collision,
    StaticObject,
    Ground,
    BornPoints,
    MarkedArea(String),
    MarkedPoint(String),
    AutoGround,
    EventArea,
    Unknown,
}

impl From<&str> for LayerType {
    fn from(layer_type: &str) -> Self {
        match layer_type.to_uppercase().as_str() {
            "WALKABLE" => LayerType::Walkable,
            "COLLISION" => LayerType::Collision,
            "STATIC_OBJECT" | "STATICOBJECT" | "STATIC OBJECT" | "STATIC" => LayerType::StaticObject,
            "BORNPOINTS" | "BORN_POINTS" | "BORN POINTS" | "BORN" => LayerType::BornPoints,
            "GROUND" => LayerType::Ground,
            "AUTO_GROUND" | "AUTO GROUND" | "AUTO" | "AUTOGROUND" => LayerType::AutoGround,
            "EVENT_AREA" | "EVENTAREA" | "EVENT" => LayerType::EventArea,
            s => match s.split_once(':') {
                Some(("MARKEDAREA"|"MARKAREA"|"AREA", type_name)) if !type_name.is_empty() => LayerType::MarkedArea(type_name.to_string()),
                Some(("MARKEDPOINT"|"MARKPOINT"|"POINT", type_name)) if !type_name.is_empty() => LayerType::MarkedPoint(type_name.to_string()),
                _ => LayerType::Unknown,
            },
        }
    }
}